package com.wewoo.log4e.test.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wewoo.log4e.core.annotation.Log4e;
import com.wewoo.log4e.core.enums.HandleType;
import com.wewoo.log4e.core.enums.OperationType;
import com.wewoo.log4e.core.enums.OperationUnit;
import com.wewoo.log4e.starter.executor.DataSourceExecutor;
import com.wewoo.log4e.starter.mongodb.executor.MongodbExecutor;
import com.wewoo.log4e.test.entity.SysUserEntity;
import com.wewoo.log4e.test.mapper.SysUserMapper;
import com.wewoo.log4e.test.model.SysUserDTO;
import com.wewoo.log4e.test.model.SysUserVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity> implements UserService {
    @Log4e(detail = "添加了备注|{{param1}}", level = 1, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT
            , executor = MongodbExecutor.class)
    @Override
    public String test(SysUserDTO sysUser) {
        return null;
    }

    @Log4e(detail = "申请分管客户", level = 1, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT)
    @Override
    public String test0(SysUserDTO sysUser) {
        return null;
    }

    @Log4e(detail = "将归属权转让给{{operateParam}}", level = 3, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT)
    @Override
    public String test1(String operateParam) {
        System.out.println("operateParam:" + operateParam);
        return "zhangsan";
    }

    @Log4e(detail = "将客户{{operateParam}}的待分配金额转让给{{operateParam2}}", level = 3, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT)
    @Override
    public String test2(String operateParam, String operateParam2) {
        return "zhangsan";
    }

    @Log4e(detail = "将归属权转让给{{param1}}", level = 3, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT)
    @Override
    public String test3(SysUserDTO sysUser) {
        return "zhangsan";
    }

    @Log4e(detail = "将客户{{param1}}的待分配金额转让给{{param2}}", level = 3, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT)
    @Override
    public String test4(SysUserDTO sysUser) {
        return null;
    }

    @Log4e(detail = "修改了供应商信息  审核单号：{{param1}}|{{param2}}", level = 3, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT)
    @Override
    public String test5(SysUserDTO sysUser) {
        return null;
    }

    @Log4e(detail = "创建了供应商 审核单号：{{param1}}", level = 3, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT, handleType = HandleType.AFTER)
    @Override
    public SysUserVO test6() {
        SysUserVO sysUserVO = new SysUserVO();
        BeanUtils.copyProperties(SysUserEntity.genTestObject(), sysUserVO);
        sysUserVO.setOperateParam(new String[]{"SH21D250937"});
        return sysUserVO;
    }
}
